<!--
 * @Date: 2023-10-19 15:23:24
 * @LastEditTime: 2023-10-20 18:24:47
 * 介绍:
-->
<cfg lang="json">
{
  "navigationBarTitleText": "web-view",
  "enablePullDownRefresh": false,
  "navigationStyle": "custom"
}
</cfg>
<script lang="ts" setup>
import { getSystemInfoCache } from "@/sdk/rewriteUni";
import { unitPx } from "@/utils/tools/css";
import { CSSProperties } from "vue";
import { webviewPage } from "@/enum/pubsub";

const url = ref("");
onLoad((query: any) => {
  url.value = query.url;
});
const sysinfo = getSystemInfoCache();
const top = sysinfo.statusBarHeight || 29;
const height = sysinfo.screenHeight - top;
const webviewStyles = computed<CSSProperties>(() => ({
  position: "fixed",
  top: unitPx(top),
  height: unitPx(height),
}));
onUnload(() => {
  uni.$emit(webviewPage.unLoad);
});
</script>
<template>
  <web-view :src="url" class="web-view" :webview-styles="webviewStyles" />
</template>
<style lang="scss" scoped></style>
